package com.winit.feature.repository;

import com.winit.feature.model.FeatureHistory;
import com.winit.feature.model.FeatureHistoryId;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IFeatureHistoryRepository extends CrudRepository<FeatureHistory, FeatureHistoryId> {
    @Query(value = "select * from matrix_feature_history where feature_id = ?1 order by create_time DESC limit 0, 1", nativeQuery = true)
    FeatureHistory findLatestVersionByFeatureId(String featureId);

    List<FeatureHistory> findByFeatureIdAndReqId(String featureId, String reqId);
    List<FeatureHistory> findByFeatureId(String featureId);
}
